<?php 
$host = $_SERVER['DOCUMENT_ROOT'];
require $host.'/libs/Smarty.class.php';
require 'sql.php';

class Smarty_Offise extends Smarty {
    function Smarty_Offise()
    {
        // Class Constructor.
        // These automatically get set with each new instance.
        parent::__construct();
        $host = $_SERVER['DOCUMENT_ROOT'];
        $this->template_dir = $host.'/templates/';
        $this->compile_dir = $host.'/templates_c/';
        $this->config_dir = $host.'/configs/';
        $this->cache_dir = $host.'/cache/';

        //$this->caching = Smarty::CACHING_LIFETIME_CURRENT;
    }
}
function not_found() {
    $smarty = new Smarty_Offise();
    header('HTTP/1.1 404 Not Found');
    $smarty->assign('title','Страница не найдена');
    $smarty->display('not-found.tpl');
        exit();
    }
function config()
{
	global $db;
	$smarty = new Smarty_Offise();
	//$db->fetchMode(Zend_Db::FETCH_OBJ);
	$select = $db->select();
	$select->from('config');
	$result = $db->fetchPairs($select);
	$smarty->assign('config',$result);
}
function arrConfig ()
{
    global $db;
    $select = $db->select();
    $select->from('config');
    $result = $db->fetchPairs($select);
    return $result;
}
    
?>